<template>
    <div class="readCostContent">
        <Card :bordered="true" dis-hover class="ivu-mb">
            <div slot="title" style="padding-top:4px;padding-bottom: 4px; ">
                <Avatar icon="md-apps" size="small" v-color="'#1890ff'" v-bg-color="'#e6f7ff'"/>
                <span class="ivu-pl-8">编辑成本中心</span>
                <span v-if="data && data.values">：{{ data.name }}</span>
            </div>
            <div>
                <div v-show="!data && !data.values">
                    <Alert>从菜单列表选择一项后，进行编辑</Alert>
                </div>
                <div v-show="data && data.values">
                    <cfgForm :cols="cols" :rules="rules" :columns="columns" ref="_frm" :data="data.values"></cfgForm>
                </div>
            </div>
<!--            <div v-show="data && data.values" style="margin-left: 100px;">-->
<!--                <Button type="primary" @click="ok">{{lang.edit}}</Button>-->
<!--            </div>-->
        </Card>
    </div>
</template>

<script>
export default {
    name: "editCostContent",
    data(){
        return {

        }
    },
    props: {
        classObject: {
            default: () => {
                return null;
            }
        },
        className: {
            default: () => {
                return '';
            }
        },
        type: {
            default: () => {
                return '';
            }
        },
        modelType: {
            default: () => {
                return '';
            }
        },
        data:{
            default: () => {
                return {};
            }
        },
        rules: {
            default: () => {
                return {};
            }
        },
        cols: {
            default: () => {
                return 2;
            }
        },
    },
    computed: {
        lang () {
            return {
                'en-US': {
                    edit: 'edit',
                    new: 'new',
                    detail: 'detail',
                    action: 'action',
                    submit: 'submit',
                    cancel: 'cancel',
                    save: 'save'
                },
                'zh-CN': {
                    edit: '编辑',
                    new: '添加',
                    detail: '查看',
                    action: '操作',
                    submit: '提交',
                    cancel: '取消',
                    save: '确定'
                }
            }[this.G_Locale]
        },
        // form中列字段
        columns () {
            return [
                {
                    key: 'code',
                    title: {
                        'zh-CN': '编码',
                        'en-US': 'code'
                    }[this.G_Locale],
                    minWidth: 100,
                    align: 'center',
                    show: true
                },
                {
                    key: 'name',
                    title: {
                        'zh-CN': '名称',
                        'en-US': 'name'
                    }[this.G_Locale],
                    minWidth: 100,
                    align: 'center',
                    show: true
                },
                {
                    key: 'brevity',
                    title: {
                        'zh-CN': '简码',
                        'en-US': 'brevity'
                    }[this.G_Locale],
                    minWidth: 70,
                    align: 'center',
                    show: true
                },
                {
                    key: 'remark',
                    title: {
                        'zh-CN': '备注',
                        'en-US': 'remark'
                    }[this.G_Locale],
                    minWidth: 100,
                    align: 'center',
                    show: true
                }
            ];
        }
    },
    methods:{
    }
}
</script>
